package com.itheima.conroller;

import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author fone
 * @date 2021/09/05
 */

@RestController
@RequestMapping("/users")
public class UserInfoController {

    @Autowired
    private UserService userService;


    @GetMapping(name = "查询用户列表", value = "/findByPage")
    public ResponseEntity findByPage(@RequestParam(value = "page", defaultValue = "1") Integer pageNum,
                                     @RequestParam(value = "pagesize", defaultValue = "10") Integer pageSize) {

        return userService.findByPage(pageNum, pageSize);
    }

    @GetMapping(name = "根据用户id获取坐标", value = "/findLocation")
    public ResponseEntity findLocation(@RequestParam(value = "id") Long userId) {

        return userService.findLocation(userId);
    }
}
